home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / proboard / pb_215.zip / PB215SDK.DOC < prev    next >
Text File  |  1996-05-05  |  68KB  |  2,049 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.       ▒▒▒▒▒▒▒▒▒▄                 ▒▒▒▒▒▒▒▒▒▄
  13.        ▒▒█▀▀▀▒▒█                  ▒▒█▀▀▀▒▒█
  14.        ▒▒█   ▒▒█ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▄  ▒▒█   ▒▒█ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▒▄
  15.        ▒▒▒▒▒▒▒▒█ ▒▒█▀▒▒█ ▒▒█▀▒▒█  ▒▒▒▒▒▒▒█▀ ▒▒█▀▒▒█ ▒▒█▀▒▒█ ▒▒█▀▒▒█  ▒▒█▀▒▒█
  16.        ▒▒█▀▀▀▀▀▀ ▒▒▒▒▒▒█ ▒▒█ ▒▒█  ▒▒█▀▀▀▒▒█ ▒▒█ ▒▒█ ▒▒▒▒▒▒█ ▒▒▒▒▒▒█  ▒▒█ ▒▒█
  17.        ▒▒█       ▒▒█▒▒█▀ ▒▒█ ▒▒█  ▒▒█   ▒▒█ ▒▒█ ▒▒█ ▒▒█▀▒▒█ ▒▒█▒▒█▀  ▒▒█ ▒▒█
  18.       ▒▒▒▒█      ▒▒█ ▒▒█ ▒▒▒▒▒▒█ ▒▒▒▒▒▒▒▒▒█ ▒▒▒▒▒▒█ ▒▒█ ▒▒█ ▒▒█ ▒▒█ ▒▒▒▒▒▒▒█
  19.        ▀▀▀▀       ▀▀  ▀▀  ▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀  ▀▀  ▀▀  ▀▀  ▀▀  ▀▀▀▀▀▀▀
  20.  
  21.                            "The Choice of Professionals"
  22.  
  23.  
  24.                              Software Developer's Kit
  25.                                    Version 2.15
  26.  
  27.                                 ++ May 5 , 1996 ++
  28.  
  29.  
  30.                    Copyright (c) 1990-1996 Philippe Leybaert
  31.                               All rights reserved
  32.  
  33.  
  34.  
  35.         ╒══════════════════════════════════════════════════════════════════╕
  36.         │░░░░░░░░ PROBOARD SOFTWARE DEVELOPMENT KIT VERSION 2.15 ░░░░░░░░░░│
  37.         ╘══════════════════════════════════════════════════════════════════╛
  38.  
  39.  
  40.          Included with ProBoard is a C library that allows you to write
  41.          your own extensions to ProBoard in C or C++. All you need is an
  42.          ANSI-compatible C or C++ compiler. The programs you create can be
  43.          run within ProBoard by executing a new menu function.
  44.  
  45.          The ProBoard SDK files included with ProBoard are free software,
  46.          so anyone who does not use ProBoard to run a BBS on a regular
  47.          basis, but wants to write extension files, is allowed to do so
  48.          without registering ProBoard. You can distribute any ProBoard
  49.          extension files (PEX files) royalty-free. As far as we are
  50.          concerned, any program you develop with the ProBoard SDK is your
  51.          property.
  52.  
  53.  
  54.  
  55.         ┌──────────────────────────────────────────────────────────────────┐
  56.         │ Requirements                                                     │
  57.         └──────────────────────────────────────────────────────────────────┘
  58.  
  59.          To create your own programs you need:
  60.  
  61.          - An ANSI compatible C or C++ compiler. Compilers known to be
  62.            compatible with the ProBoard SDK are:
  63.  
  64.               - Zortech C/C++ 2.0 - 3.0
  65.               - Microsoft C/C++ 5.1 - 7.0
  66.               - Borland C++ 2.0 - 4.5
  67.               - Turbo C++ 1.0
  68.               - Turbo C 1.0 - 2.0
  69.  
  70.            Other compilers may work too, but were not tested.
  71.  
  72.          - An MS-compatible linker (usually the one that came with your
  73.            compiler).
  74.  
  75.            Linkers known to work with the ProBoard SDK are:
  76.  
  77.               - All Microsoft Linkers (LINK.EXE)
  78.               - Borland's Turbo Link (TLINK)
  79.               - Zortech's BLINK
  80.  
  81.          - The ProBoard SDK include file PB_SDK.H
  82.  
  83.          - The ProBoard SDK library PB_SDK.LIB (for non-Borland compilers)
  84.          - The ProBoard SDK file PB_SDK.OBJ (for Borland 3.x compilers)
  85.  
  86.  
  87.                                       - 1 -
  88.  
  89.  
  90.  
  91.         ┌──────────────────────────────────────────────────────────────────┐
  92.         │ Creating ProBoard Executables (PEX-files)                        │
  93.         └──────────────────────────────────────────────────────────────────┘
  94.  
  95.          To create your own ProBoard executable (.PEX file), you first
  96.          create a source file, say MYPROG.C. When ProBoard loads a PEX
  97.          file, it executes the function main() in your program. This
  98.          function is defined as:
  99.  
  100.          void
  101.          main(int argc,char *argv[])
  102.          {
  103.           ...
  104.          }
  105.  
  106.          The parameters 'argc' & 'argv' contain optional data that can be
  107.          given to your program at load time (exactly like C's argc and argv
  108.          parameters).  Creating this main() function is the only thing you
  109.          need to do to write a valid ProBoard executable. From this point
  110.          on, it's just like writing a regular C program.  Most of the ANSI
  111.          standard library functions are available, plus many ProBoard-
  112.          specific functions and global variables, used for interfacing
  113.          between your program and the ProBoard environment.  As in a regular
  114.          executable, you can build your program from several source files.
  115.  
  116.          This is a tiny sample ProBoard program:
  117.  
  118.          #include "pb_sdk.h"
  119.  
  120.          void
  121.          main()
  122.          {
  123.             printf("You have %d minutes left.\n",TimeLeft());
  124.  
  125.             AddTime(10);
  126.  
  127.             printf("Now you have %d minutes left.\n",TimeLeft());
  128.          }
  129.  
  130.  
  131.          Included with ProBoard are a few example programs (in source form
  132.          of course).
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.                                       - 2 -
  144.  
  145.  
  146.  
  147.         ┌──────────────────────────────────────────────────────────────────┐
  148.         │ Compiling and Linking                                            │
  149.         └──────────────────────────────────────────────────────────────────┘
  150.  
  151.          ProBoard executables have to be compiled using the LARGE memory
  152.          model.
  153.  
  154.          For example (Turbo C++) : tcc -c -ml myprog.c
  155.  
  156.          Once you have your .OBJ file (in this case MYPROG.OBJ), you have
  157.          to link it with the ProBoard SDK library (PB_SDK.LIB). You have to
  158.          specify a filename as output filename. The linked executable must
  159.          have extension .PEX. It is important to disable linking of the
  160.          default compiler libraries!! It is also required to turn on
  161.          case sensitivity.
  162.  
  163.          e.g.   Turbo C++ :  TLINK MYPROG,MYPROG.PEX,,PB_SDK /N /C
  164.                 Microsoft :  LINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  165.                 Zortech   :  BLINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  166.  
  167.          That's all there is to it. Now you can run your program through
  168.          ProBoard's menu function 60.
  169.  
  170.          I will now give the compiler syntax for some popular compilers:
  171.  
  172.           Zortech C/C++ : ztc -c -a -ml myprog.c
  173.           Microsoft C   : cl -Zep -Gs -c -AL myprog.c
  174.           Turbo C/C++   : tcc -c -ml myprog.c
  175.           Borland C++   : bcc -c -ml myprog.c
  176.  
  177.          And linker syntax:
  178.  
  179.           Borland       : TLINK PB_SDK MYPROG,MYPROG.PEX /N /C
  180.           Microsoft     : LINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  181.           Zortech       : BLINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  182.  
  183.          Note that the syntax for Borland C++ has changed from previous
  184.          versions of the SDK. It is required that you specify PB_SDK.OBJ
  185.          BEFORE your object files, and don't link PB_SDK.LIB.
  186.  
  187.  
  188.  
  189.         ┌──────────────────────────────────────────────────────────────────┐
  190.         │ Restrictions                                                     │
  191.         └──────────────────────────────────────────────────────────────────┘
  192.  
  193.          There are few restrictions in writing ProBoard executables. For C
  194.          programs there are actually only two major restriction: long math
  195.          & floating point operations.
  196.  
  197.  
  198.  
  199.                                       - 3 -
  200.  
  201.  
  202.  
  203.          Due to the fact that all compilers generate function calls to
  204.          multiply, divide and shift long integers, and that every compiler
  205.          vendor uses its own array of functions, it is impossible to
  206.          include these functions in the ProBoard SDK. As a result, it is
  207.          not directly possible to perform these operations on long values
  208.          (eg. long1 = long2 * long3). However, we did include functions to
  209.          perform these operations, but you will have to call these
  210.          functions explicitly (eg. long1 = l_mul(long2,long3)).  People who
  211.          know their compiler well, can work around this problem by
  212.          extracting the long math functions from the standard library, and
  213.          linking them with the PEX file. For example, the long math
  214.          functions used by the Zortech compiler are in the module
  215.          LMATH.OBJ, located in the library ZLC.LIB. Extracting this module
  216.          is as simple as :  ZORLIB ZLS *LMATH;
  217.  
  218.          These are the ProBoard long math functions that you can use:
  219.  
  220.          long l_mul(long1,long2)   Multiply 2 long values   = long1 * long2
  221.          long l_div(long1,long2)   Divide 2 long values     = long1 / long2
  222.          long l_mod(long1,long2)   Modulo of 2 long values  = long1 % long2
  223.          long l_shl(long1,int1)    Left shift a long value  = long1 << int1
  224.          long l_shr(long1,int1)    Right shift a long value = long1 >> int1
  225.  
  226.          The functions l_div(), l_mod(), l_shl() and l_shr() are also
  227.          available for unsigned long values: ul_div(), ul_mod(), ul_shl()
  228.          and ul_shr().
  229.  
  230.          Floating point operations are NOT supported. So it is not possible
  231.          to use 'double' and 'float' variables & constants.
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.                                       - 4 -
  256.  
  257.  
  258.  
  259.          Another major restriction only affects C++ programs that are
  260.          compiled with some other compiler than Borland C/C++ 3.x or
  261.          Zortech C++ 3.0.  In a ProBoard C++ program that is not compiled
  262.          with one of the compilers mentioned, you can't declare global
  263.          variables that have constructors or destructors (ie. no static
  264.          constructors & destructors). So this will compile fine, but will
  265.          certainly crash your machine:
  266.  
  267.          class myclass
  268.             {
  269.                 int a;
  270.             public:
  271.                 x() { .... some action .... }
  272.                ~x() { .... some action .... }
  273.             };
  274.  
  275.          myclass some_global_object;
  276.  
  277.          main()
  278.          {
  279.          ...
  280.          }
  281.  
  282.          You can, however, use objects with constructors and destructors,
  283.          as long as they are declared within a function. So this would
  284.          work:
  285.  
  286.          main()
  287.          {
  288.           myclass some_local_object;
  289.           ....
  290.          }
  291.  
  292.  
  293.  
  294.         ┌──────────────────────────────────────────────────────────────────┐
  295.         │ Library functions supported                                      │
  296.         └──────────────────────────────────────────────────────────────────┘
  297.  
  298.          Almost all standard library functions are supported. Note that all
  299.          functions that write to the standard output device (printf,
  300.          putchar,...) write their output to the ProBoard window and to the
  301.          user (through the modem).  Functions that read from the standard
  302.          input device and from the keyboard are NOT supported.
  303.          (scanf,getch,gets,...) We provide substitutes for these functions.
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                                       - 5 -
  312.  
  313.  
  314.  
  315.          Functions supported:
  316.  
  317.               fopen , freopen , fseek , ftell , fgets , fgetc , fflush
  318.               fclose , fputs , getc , getchar , gets , fputc , putc ,
  319.               putchar , puts , fread , fwrite , printf , fprintf ,
  320.               vfprintf , vprintf , sprintf , vsprintf , setbuf ,
  321.               setvbuf , remove , rename , rewind , clearerr , feof ,
  322.               isalpha , iscntrl , isdigit , isgraph , islower ,
  323.               isprint , ispunct , isspace , isupper , isxdigit ,
  324.               toupper , tolower , int86x , intdos , intdosx ,
  325.               dos_findfirst , dos_findnext , write , open , creat ,
  326.               close , unlink , chsize , dup , dup2 , lseek , access ,
  327.               filesize , filelength , isatty , atoi , atol , strtol ,
  328.               rand , srand , calloc , free , malloc , realloc , putenv
  329.               getenv , abs , labs , memcpy , memmove , strcpy , strncpy ,
  330.               strcat , strncat , memcmp , strcmp , strncmp , memchr ,
  331.               strchr , strcspn , strpbrk , strrchr , strspn , strstr ,
  332.               strtok , memset , strlen , memicmp , stpcpy , strcmpl ,
  333.               strnicmp , strdup , strlwr , strupr , strnset , strrev ,
  334.               strset , swab , strncmpl , strnicmp , clock , time , mktime ,
  335.               asctime , ctime , localtime , gmtime , strftime , sleep ,
  336.               usleep , msleep , difftime, mkdir(), chdir(), rmdir()
  337.  
  338.  
  339.          For information on these functions, consult your compiler's
  340.          library reference manual.
  341.  
  342.          In the string output functions (printf and puts), you can use the
  343.          following control codes in your string:
  344.  
  345.          \001 or \x01   Set output color to red
  346.          ::::    ::::
  347.          ::::    ::::
  348.          \007 or \x07   Set output color to white
  349.  
  350.          \x11 to \x17   Same as \1 to \7, but blinking colors
  351.  
  352.          \t             Stops output of string until user presses [Enter]
  353.          \f             Clears the user's screen (if enabled in the user's
  354.                         record)
  355.  
  356.  
  357.          NOTE: Do NOT include any standard include files from your
  358.          compiler. The only include file you can use is PB_SDK.H.
  359.          THAT'S IT!!
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.                                       - 6 -
  368.  
  369.  
  370.  
  371.         ┌──────────────────────────────────────────────────────────────────┐
  372.         │ ProBoard Interface Functions                                     │
  373.         └──────────────────────────────────────────────────────────────────┘
  374.  
  375.          This is a list of all the functions that can be used to interface
  376.          with ProBoard.
  377.  
  378.          Several types have been defined in the file PB_SDK.H
  379.  
  380.            bool    : a boolean value that can have the values TRUE or FALSE
  381.            byte    : an unsigned character (8 bits)
  382.            word    : an unsigned short integer (16 bits)
  383.            dword   : an unsigned long integer (32 bits)
  384.            KEY     : used for key scan codes (for sysopkey handlers and the
  385.                      ScanKey() function).
  386.  
  387.  
  388.          ──────────────────────────────────────────────────────────────────
  389.          void AddTime(int min);
  390.          ──────────────────────────────────────────────────────────────────
  391.  
  392.          Adds 'min' minutes to the user's time left. If 'min' is negative,
  393.          the number of minutes will be subtracted from the time left.
  394.  
  395.          Examples:    AddTime(10);         /* Adds 10 minutes */
  396.                       AddTime(-5);         /* Subtracts 5 minutes */
  397.  
  398.  
  399.  
  400.          ──────────────────────────────────────────────────────────────────
  401.          int TimeLeft(void);
  402.          ──────────────────────────────────────────────────────────────────
  403.  
  404.          Returns the time left in minutes for the current user.
  405.  
  406.  
  407.  
  408.          ──────────────────────────────────────────────────────────────────
  409.          int TimeOnline(void);
  410.          ──────────────────────────────────────────────────────────────────
  411.  
  412.          Returns the time in minutes that the current user is online.
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.                                       - 7 -
  424.  
  425.  
  426.  
  427.          ──────────────────────────────────────────────────────────────────
  428.          void SuspendTimer(void);
  429.          ──────────────────────────────────────────────────────────────────
  430.  
  431.          Suspends the online-timer for the current user. No time will be
  432.          subtracted until RestartTimer() is called.
  433.  
  434.  
  435.  
  436.          ──────────────────────────────────────────────────────────────────
  437.          void RestartTimer(void);
  438.          ──────────────────────────────────────────────────────────────────
  439.  
  440.          Restarts the timer after a call to SuspendTimer().
  441.  
  442.  
  443.  
  444.          ──────────────────────────────────────────────────────────────────
  445.          void AdjustTime(void);
  446.          ──────────────────────────────────────────────────────────────────
  447.  
  448.          Call this function if you changed the user's level. This
  449.          recalculates all limits (time,download,...).
  450.  
  451.  
  452.  
  453.          ──────────────────────────────────────────────────────────────────
  454.          void MsgEd(void);
  455.          ──────────────────────────────────────────────────────────────────
  456.  
  457.          Fires up the internal message editor or the fullscreen editor,
  458.          depending on the settings of the user. The message will be stored
  459.          in the file MSGTMP in the current directory. If a message is
  460.          aborted, the file MSGTMP will be deleted by the message editor.
  461.          If you create a MSGTMP file before invoking the message editor,
  462.          this file will be used as a 'quote' message.
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.                                       - 8 -
  480.  
  481.  
  482.  
  483.          ──────────────────────────────────────────────────────────────────
  484.          int PostMessage(char *from,char *to,char *subject,int area,
  485.                          bool pvt);
  486.          ──────────────────────────────────────────────────────────────────
  487.  
  488.          Posts a message to a user.
  489.  
  490.             from    = Name of the sender
  491.             to      = Name of the user you're sending the message to
  492.             subject = Subject of the message
  493.             area    = Message area number where the message has to
  494.                       be posted in.
  495.             pvt     = Private status (TRUE=private, FALSE=public)
  496.  
  497.          No checking is performed on any of the parameters!
  498.  
  499.  
  500.          Return value: -1 on error
  501.                         0 if ok
  502.  
  503.  
  504.  
  505.          ──────────────────────────────────────────────────────────────────
  506.          int PostNetmail(char *from,char *to,char *subject,int area,
  507.                          FIDO_NODE *address,bool attach,bool crash,
  508.                          bool kill);
  509.          ──────────────────────────────────────────────────────────────────
  510.  
  511.          Posts a netmail message.
  512.  
  513.             from    = Name of the sender
  514.             to      = Name of the user you're sending the message to
  515.             subject = Subject of the message
  516.             area    = Message area number where the message has to
  517.                       be posted in
  518.             address = Destination node number of this message.
  519.             attach  = TRUE for a file attach message
  520.             crash   = TRUE if this message is a crashmail message
  521.             kill    = TRUE if the message has to be deleted after it is
  522.                       sent
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.                                       - 9 -
  536.  
  537.  
  538.  
  539.          FIDO_NODE is a structure with the following fields:
  540.  
  541.            struct
  542.              {
  543.               unsigned zone;  /* Zone number  */
  544.               unsigned net;   /* Net number   */
  545.               unsigned node;  /* Node number  */
  546.               unsigned point; /* Point number */
  547.              }
  548.  
  549.          No checking is performed on any of the parameters!
  550.  
  551.          Return value: -1 on error
  552.                         0 if ok
  553.  
  554.  
  555.  
  556.          ──────────────────────────────────────────────────────────────────
  557.          bool ReadMsgArea(int area,MSGAREA *ma);
  558.          ──────────────────────────────────────────────────────────────────
  559.  
  560.          Reads data about a message area.
  561.  
  562.               area  = Message area number (1-200)
  563.               ma    = Pointer to a MSGAREA structure to be filled
  564.  
  565.          Check the file PB_SDK.H for details about the MSGAREA structure
  566.          definition.
  567.  
  568.          Return value:  FALSE if not defined
  569.                         TRUE  if read ok
  570.  
  571.  
  572.  
  573.          ──────────────────────────────────────────────────────────────────
  574.          bool ReadMessage(MESSAGE *msg,long msgid,int areanum);
  575.          ──────────────────────────────────────────────────────────────────
  576.  
  577.          Reads message id <msgid> from area numer <areanum> into the
  578.          MESSAGE structure.  To access the text of the message, use the
  579.          function CreateMessageText().  See the file PB_SDK.H for a
  580.          description of the MESSAGE structure.
  581.  
  582.          Return value: FALSE if the message does not exists
  583.                        TRUE  if the message is read ok
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.                                       - 10 -
  592.  
  593.  
  594.  
  595.          ──────────────────────────────────────────────────────────────────
  596.          void WriteMSGTMP(char *text);
  597.          ──────────────────────────────────────────────────────────────────
  598.  
  599.          Writes the string <text> to the file MSGTMP. The file is always
  600.          recreated when using this function. To append text to MSGTMP,
  601.          use the function AppendMSGTMP(). You have to insert your own CR/LF
  602.          pairs in the text if you want to force a newline.  Lines can be
  603.          longer than 80 characters.  The message processing functions will
  604.          do a word-wrap if necessary.  Do NOT insert a single CR or LF in
  605.          the text. (\r or \n).
  606.  
  607.  
  608.  
  609.          ──────────────────────────────────────────────────────────────────
  610.          void AppendMSGTMP(char *text);
  611.          ──────────────────────────────────────────────────────────────────
  612.  
  613.          Same as WriteMSGTMP(), but adds text to an EXISTING file.
  614.  
  615.  
  616.  
  617.          ──────────────────────────────────────────────────────────────────
  618.          void ShowMessage(MESSAGE *msg);
  619.          ──────────────────────────────────────────────────────────────────
  620.  
  621.          Shows the message <msg> to the user, including header and message
  622.          text.
  623.          See the file PB_SDK.H for an description of the MESSAGE structure.
  624.  
  625.  
  626.  
  627.          ──────────────────────────────────────────────────────────────────
  628.          void CreateMessageText(MESSAGE *msg);
  629.          ──────────────────────────────────────────────────────────────────
  630.  
  631.          Reads the text that belongs to message <msg>, and stores it in a
  632.          file called MSGTMP in the current directory. This file can then be
  633.          accessed as an ordinary textfile.
  634.  
  635.  
  636.  
  637.          ──────────────────────────────────────────────────────────────────
  638.          void CreateMessageTextString(MESSAGE *msg,char *text,int max);
  639.          ──────────────────────────────────────────────────────────────────
  640.  
  641.          Reads the text that belongs to message <msg>, and stores it in the
  642.          string <text>. The text will be terminated by a '\0' character.
  643.          You have to specify a maximum number of characters that can be
  644.          stored in <text>.
  645.  
  646.  
  647.                                       - 11 -
  648.  
  649.  
  650.  
  651.          ──────────────────────────────────────────────────────────────────
  652.          bool FirstMessage(MESSAGE *msg,int area,int order,long first);
  653.          bool NextMessage(MESSAGE *msg,int area,int order);
  654.          ──────────────────────────────────────────────────────────────────
  655.  
  656.          These functions are used to read messages in forward or reverse
  657.          order. To start scanning messages, you have to call the
  658.          FirstMessage() function first, and the NextMessage() function to
  659.          read more messages.
  660.  
  661.          msg   = MESSAGE structure where the message has to be stored.
  662.          area  = area number to read messages in
  663.          order = 1 for forward order, -1 for reverse order
  664.          first = message to start reading from. This message does NOT
  665.                  need to exist. The first non-deleted message following
  666.                  this message will be read first.
  667.  
  668.          See the file PB_SDK.H for an description of the MESSAGE structure.
  669.  
  670.          Return value: FALSE  No more messages found.
  671.                        TRUE   Message was found and read ok.
  672.  
  673.  
  674.          This is an example on how to use these functions:
  675.  
  676.          result = FirstMessage(msg,5,+1,1);
  677.          while(result == TRUE)
  678.            {
  679.             /* Do something with the message */
  680.             result = NextMessage(msg,5,+1);
  681.            }
  682.  
  683.  
  684.  
  685.          ──────────────────────────────────────────────────────────────────
  686.          void DeleteMessage(MESSAGE *msg);
  687.          ──────────────────────────────────────────────────────────────────
  688.  
  689.          Deletes message <msg>.
  690.  
  691.  
  692.  
  693.          ──────────────────────────────────────────────────────────────────
  694.          void MarkMessage(long msgid);
  695.          ──────────────────────────────────────────────────────────────────
  696.  
  697.          Marks message <msgid> for later retrieval. Up to 200 messages can
  698.          be marked.
  699.  
  700.  
  701.  
  702.  
  703.                                       - 12 -
  704.  
  705.  
  706.  
  707.          ──────────────────────────────────────────────────────────────────
  708.          void ReadMarkedMessages(void);
  709.          ──────────────────────────────────────────────────────────────────
  710.  
  711.          Shows all marked messages to the user, with the option to wait
  712.          after each message. If the user selected to wait after each
  713.          message, the standard message options menu will be shown to the
  714.          user. (Next,Prev,Stop,...).
  715.          In fact, this function is identical to menu function "Read
  716.          Messages", with the user selecting "Marked".
  717.  
  718.  
  719.  
  720.          ──────────────────────────────────────────────────────────────────
  721.          void ListMarkedMessages(void);
  722.          ──────────────────────────────────────────────────────────────────
  723.  
  724.          Is similar to ReadMarkedMessages(), but this function acts as a
  725.          "QuickScan Messages" with the user selecting "Marked".
  726.  
  727.  
  728.  
  729.          ──────────────────────────────────────────────────────────────────
  730.          void UnMarkAllMessages(void);
  731.          ──────────────────────────────────────────────────────────────────
  732.  
  733.          Unmarks all messages that were previously marked. You have to call
  734.          this function before marking any messages, because the list of
  735.          marked messages is remembered until a user logs off.
  736.  
  737.  
  738.  
  739.          ──────────────────────────────────────────────────────────────────
  740.          int NumMsgAreas(void);
  741.          ──────────────────────────────────────────────────────────────────
  742.  
  743.          Returns the highest message area number that is not empty.
  744.  
  745.  
  746.  
  747.          ──────────────────────────────────────────────────────────────────
  748.          long GetLastRead(int areanum , long user_recno);
  749.          void SetLastRead(int areanum , long user_recno , long msgid);
  750.          ──────────────────────────────────────────────────────────────────
  751.  
  752.          Reads / Sets the lastread pointer for a specific user and message
  753.          area.  If GetLastRead() returns -1, an error occurred.
  754.  
  755.  
  756.  
  757.  
  758.  
  759.                                       - 13 -
  760.  
  761.  
  762.  
  763.          <areanum> ..... The area number (1-10000)
  764.          <user_recno> .. The record number of the user (0 - ...)
  765.          <msgid> ....... The id of the message you want to set the
  766.                          lastread pointer to.
  767.  
  768.  
  769.  
  770.          ──────────────────────────────────────────────────────────────────
  771.          int FuzzySearch(char *text,char *string,int degree);
  772.          ──────────────────────────────────────────────────────────────────
  773.  
  774.          Performs a fuzzy search for <string> in <text>. <degree> is the
  775.          percentage of the characters in <string> that have to match.
  776.  
  777.          Return value: -1 if not found
  778.                        >0 percentage of characters matched
  779.  
  780.  
  781.  
  782.          ──────────────────────────────────────────────────────────────────
  783.          IO_... functions
  784.          ──────────────────────────────────────────────────────────────────
  785.  
  786.          All functions starting with IO_ are low-level functions to access
  787.          the serial port directly. Do NOT use these functions for ordinary
  788.          I/O operations. They are intended for writing file transfer
  789.          protocols. See the file PB_SDK.H for the prototypes of these
  790.          functions.
  791.  
  792.  
  793.  
  794.          ──────────────────────────────────────────────────────────────────
  795.          char WaitKey(void);
  796.          ──────────────────────────────────────────────────────────────────
  797.  
  798.          Waits for a character to be read from the modem or local keyboard.
  799.  
  800.          Return value: the character read.
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.                                       - 14 -
  816.  
  817.  
  818.  
  819.          ──────────────────────────────────────────────────────────────────
  820.          char WaitKeys(char *keylist);
  821.          ──────────────────────────────────────────────────────────────────
  822.  
  823.          Waits for any character specified in <keylist>.
  824.  
  825.          Return value: the key from the list that was pressed (converted to
  826.                        uppercase if the key is a letter).
  827.  
  828.          Example : c = WaitKeys("ABC\r\x1b");
  829.                    /* Waits for A,B,C,<Enter> or <Esc> */
  830.  
  831.  
  832.  
  833.          ──────────────────────────────────────────────────────────────────
  834.          void Input(char *buf,int len,int readmode);
  835.          ──────────────────────────────────────────────────────────────────
  836.  
  837.          Asks for a string from the user. The string is stored in <buf>,
  838.          and the user will not be allowed to enter more than <len>
  839.          characters.
  840.  
  841.          <readmode> :  INPUT_ALL      : All characters are allowed
  842.                        INPUT_UPFIRST  : First character of each word is
  843.                                         converted to uppercase.
  844.                        INPUT_UPALL    : All characters are converted to
  845.                                         uppercase.
  846.                        INPUT_DIGITS   : Only digits are accepted.
  847.  
  848.                        INPUT_NOFIELD  : OR together with any of the
  849.                                         previous modes if you don't want an
  850.                                         input-field background to be
  851.                                         displayed.
  852.  
  853.  
  854.  
  855.          ──────────────────────────────────────────────────────────────────
  856.          bool Ask(bool default);
  857.          ──────────────────────────────────────────────────────────────────
  858.  
  859.          Asks for a Yes or No response from the user. Pressing 'Y' returns
  860.          TRUE and outputs "Yes". Pressing 'N' returns FALSE and sends "No"
  861.          to the user. Pressing <Enter> returns <default>, and sends "Yes"
  862.          or "No", depending on <default>.
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.                                       - 15 -
  872.  
  873.  
  874.  
  875.          ──────────────────────────────────────────────────────────────────
  876.          char PeekChar(void);
  877.          ──────────────────────────────────────────────────────────────────
  878.  
  879.          Checks if a character is available in the input buffer, and
  880.          returns that character if there is.
  881.  
  882.          Return value:     0 if no character available
  883.                         != 0 the character read (key pressed by user)
  884.  
  885.  
  886.  
  887.          ──────────────────────────────────────────────────────────────────
  888.          void SetColor(char color);
  889.          ──────────────────────────────────────────────────────────────────
  890.  
  891.          Changes the current output color. All text that is output after
  892.          this function is called will be displayed in the specified color.
  893.          This function does nothing when the user does not have ANSI or
  894.          AVATAR enabled.
  895.  
  896.          <color> can be one of the following:
  897.  
  898.             BLACK , RED , GREEN , YELLOW , MAGENTA , BLUE , CYAN , WHITE
  899.  
  900.  
  901.  
  902.          ──────────────────────────────────────────────────────────────────
  903.          void SetfullColor(unsigned char color);
  904.          ──────────────────────────────────────────────────────────────────
  905.  
  906.          Changes the current foreground & background color. The color code
  907.          is an IBM-type screen color code. This function does nothing when
  908.          the user does not have ANSI or AVATAR enabled.
  909.  
  910.          Some examples:
  911.  
  912.              0x1E : Bright yellow on dark blue background.
  913.              0x87 : Blinking white on a black background.
  914.  
  915.  
  916.  
  917.          ──────────────────────────────────────────────────────────────────
  918.          void GotoXY(int x,int y);
  919.          ──────────────────────────────────────────────────────────────────
  920.  
  921.          Moves the cursor to position (x,y). The upper left corner of the
  922.          screen is (1,1). This function does nothing when the user does
  923.          not have ANSI or AVATAR enabled.
  924.  
  925.  
  926.  
  927.                                       - 16 -
  928.  
  929.  
  930.  
  931.          ──────────────────────────────────────────────────────────────────
  932.          void ClrEol();
  933.          ──────────────────────────────────────────────────────────────────
  934.  
  935.          Clears from the current cursor position to the end of the
  936.          line. This function does nothing when the user does not have ANSI
  937.          or AVATAR enabled.
  938.  
  939.  
  940.  
  941.          ──────────────────────────────────────────────────────────────────
  942.          void EnableStop(void);
  943.          void DisableStop(void);
  944.          bool Stopped(void);
  945.          ──────────────────────────────────────────────────────────────────
  946.  
  947.          Enables stopping of output by pressing 'S'. When enabled, a user
  948.          can press 'S' to stop incoming text. When this happens, any
  949.          string output function will immediately return to the caller, en
  950.          the function Stopped() will return TRUE to indicate that the user
  951.          requested to stop output.
  952.  
  953.          EnableStop()       Enables this feature and sets the "stopped"
  954.                             status to FALSE .
  955.          DisableStop()      Disables the stop feature.
  956.          Stopped()          Returns the "stopped" flag (TRUE or FALSE).
  957.  
  958.  
  959.          Example:
  960.  
  961.               EnableStop();
  962.               for(i=0;i<100;i++)
  963.                 {
  964.                  printf("...something...");
  965.                  if(Stopped()) break;
  966.                 }
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.                                       - 17 -
  984.  
  985.  
  986.  
  987.          ──────────────────────────────────────────────────────────────────
  988.          char ShowHotkeyFile(char *filename,char *hotkeys);
  989.          ──────────────────────────────────────────────────────────────────
  990.  
  991.          Shows the file <filename> to the user, and watches for incoming
  992.          keys that are specified in <hotkeys>. If one of these keys is
  993.          detected, the function stops output, and returns the hotkey. The
  994.          "stop" feature will be enabled when sending the file.
  995.  
  996.          Return value:    0 : File sent completely and no hotkeys pressed.
  997.                           1 : 'S' pressed (output stopped)
  998.                           2 : File not found
  999.                         !=2 : Hotkey detected
  1000.  
  1001.  
  1002.  
  1003.          ──────────────────────────────────────────────────────────────────
  1004.          char ShowHotkeyANSIFile(char *filename,char *hotkeys);
  1005.          ──────────────────────────────────────────────────────────────────
  1006.  
  1007.          This function is identical to ShowKotkeyFile(), except for the
  1008.          fact that no extension and path can be specified. Depending on the
  1009.          setting of the user, <filename>.ANS/ASC in the textfiles
  1010.          directory will be sent. If no .ANS file is found, it will try to
  1011.          send the .ASC file. If that fails too, 2 will be returned.
  1012.  
  1013.          Return value:    0 : File sent completely and no hotkeys pressed.
  1014.                           1 : 'S' pressed (output stopped)
  1015.                           2 : File not found
  1016.                         !=2 : Hotkey detected
  1017.  
  1018.  
  1019.  
  1020.          ──────────────────────────────────────────────────────────────────
  1021.          void InitLineCounter(void);
  1022.          bool LineCounter(void);
  1023.          ──────────────────────────────────────────────────────────────────
  1024.  
  1025.          These functions are used to support page pausing ("More Y/N").
  1026.          Calling InitLineCounter() initializes the line counter to 0.
  1027.          Every time you call LineCounter(), the line counter is incremented
  1028.          by one. If the counter reaches the screen length, the user will be
  1029.          asked if he wants to continue reading. If he selects "No", the
  1030.          LineCounter() function will return FALSE.
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.                                       - 18 -
  1040.  
  1041.  
  1042.  
  1043.          Example:
  1044.  
  1045.              InitLineCounter();
  1046.              for(;;)
  1047.                {
  1048.                 printf("...something...\n");
  1049.                 if(!LineCounter()) break;
  1050.                }
  1051.  
  1052.  
  1053.  
  1054.          ──────────────────────────────────────────────────────────────────
  1055.          bool ExternalInput(void);
  1056.          ──────────────────────────────────────────────────────────────────
  1057.  
  1058.          Returns TRUE when the last character that was read through any of
  1059.          the input routings originated from the remote keyboard (ie. the
  1060.          sysop did not type it).
  1061.  
  1062.  
  1063.  
  1064.          ──────────────────────────────────────────────────────────────────
  1065.          int ReadUser(USER_REC *rec,int recnr);
  1066.          ──────────────────────────────────────────────────────────────────
  1067.  
  1068.          Reads user record number <recnr> (0-...) from the user file and
  1069.          stores it in <rec>.
  1070.  
  1071.          Return value:  -1 if record does not exist.
  1072.                          0 if record is read ok.
  1073.  
  1074.  
  1075.  
  1076.          ──────────────────────────────────────────────────────────────────
  1077.          void WriteUser(USER_REC *rec);
  1078.          ──────────────────────────────────────────────────────────────────
  1079.  
  1080.          Writes user record <rec> to the user file.  The record number is
  1081.          stored in the USER_REC structure.  If you want to write a
  1082.          user record to a different position in the user file, you have to
  1083.          change the 'record' field in the USER_REC structure.
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.                                       - 19 -
  1096.  
  1097.  
  1098.  
  1099.          ──────────────────────────────────────────────────────────────────
  1100.          bool SetUser(long recnr);
  1101.          ──────────────────────────────────────────────────────────────────
  1102.  
  1103.          Sets the internal ProBoard user record to record number <recnr>.
  1104.          This function should ONLY be called from _LOGIN.PEX !!
  1105.  
  1106.          Return value:  TRUE on success
  1107.                         FALSE on error
  1108.  
  1109.  
  1110.  
  1111.          ──────────────────────────────────────────────────────────────────
  1112.          char PlayMusic(char *filename,char *hotkeys);
  1113.          ──────────────────────────────────────────────────────────────────
  1114.  
  1115.          Plays a .MUS file. The file has to be located in the ProBoard
  1116.          system directory. Do not include a path and extension in
  1117.          <filename>. The music can be stopped if the sysop presses one of
  1118.          the keys specified in <hotkeys>.            ^^^^^
  1119.  
  1120.          Return value:   0   Music file played till the end
  1121.                          1   Music file not found
  1122.                          >1  The hotkey pressed by the SYSOP
  1123.                                                        ^^^^^
  1124.  
  1125.  
  1126.          ──────────────────────────────────────────────────────────────────
  1127.          void PostInfo(char *filename);
  1128.          ──────────────────────────────────────────────────────────────────
  1129.  
  1130.          Does exactly the same as the POSTINFO statement in a .Q-A file.
  1131.          No path and extension is allowed in <filename>. The file where
  1132.          the information will be written to will have the extension .ASW
  1133.          and will be placed in the ProBoard system directory.
  1134.  
  1135.  
  1136.  
  1137.          ──────────────────────────────────────────────────────────────────
  1138.          int ReadFileArea(int areanum,FILEAREA *fa);
  1139.          ──────────────────────────────────────────────────────────────────
  1140.  
  1141.          Reads information about file area number <areanum> in the <fa>
  1142.          structure.
  1143.          Check the file PB_SDK.H for details about the FILEAREA structure.
  1144.  
  1145.          Return value:   -1   File area does not exist
  1146.                           0   Ok
  1147.  
  1148.  
  1149.  
  1150.  
  1151.                                       - 20 -
  1152.  
  1153.  
  1154.  
  1155.          ──────────────────────────────────────────────────────────────────
  1156.          void MenuFunction(int function,char *data);
  1157.          ──────────────────────────────────────────────────────────────────
  1158.  
  1159.          Executes menu function <function> with <data>. For details, see
  1160.          the menu functions description in this file.
  1161.          There are named constants declared for each function in the file
  1162.          PB_SDK.H. It is recommended that you use these constants instead
  1163.          of numbers.
  1164.  
  1165.  
  1166.  
  1167.          ──────────────────────────────────────────────────────────────────
  1168.          void Log(int loglevel,char *fmt,...);
  1169.          ──────────────────────────────────────────────────────────────────
  1170.  
  1171.          With this function you can write information to the ProBoard
  1172.          logfile. The log entry will be written if the user has a loglevel
  1173.          that is greater than <loglevel> .
  1174.  
  1175.          <loglevel> can be one of the following:
  1176.  
  1177.              LOG_FRIEND , LOG_NORMAL , LOG_SUSPICIOUS , LOG_DANGEROUS
  1178.  
  1179.          If you want a log entry to be written regardless of the user's
  1180.          loglevel, use LOG_FRIEND.
  1181.  
  1182.          The Log() function works like the printf function: you can use
  1183.          format specifiers in the <fmt> string, and pass extra parameters.
  1184.  
  1185.          Example:   Log(LOG_NORMAL,"User's name = %s",CurUser->name);
  1186.  
  1187.  
  1188.  
  1189.          ──────────────────────────────────────────────────────────────────
  1190.          void HangUp();
  1191.          ──────────────────────────────────────────────────────────────────
  1192.  
  1193.          Hangs up the phone, logging off the user. It is exactly the same
  1194.          as pressing Alt-H.
  1195.  
  1196.  
  1197.  
  1198.          ──────────────────────────────────────────────────────────────────
  1199.          bool CheckAccess(int level,long flags);
  1200.          ──────────────────────────────────────────────────────────────────
  1201.  
  1202.          Checks if the current user can access something that requires
  1203.          <level> and <flags>. Returns TRUE if the user has access, FALSE if
  1204.          not.
  1205.  
  1206.  
  1207.                                       - 21 -
  1208.  
  1209.  
  1210.  
  1211.          ──────────────────────────────────────────────────────────────────
  1212.          KEY ScanKey(void);
  1213.          ──────────────────────────────────────────────────────────────────
  1214.  
  1215.          Checks the LOCAL keyboard for a key, and returns the scan code for
  1216.          that key. If no key is available, 0 will be returned.
  1217.  
  1218.          For a list of defined values for scan codes, check the file
  1219.          PB_SDK.H.
  1220.  
  1221.  
  1222.  
  1223.          ──────────────────────────────────────────────────────────────────
  1224.          bool GetFlag(long flags,char flagchar);
  1225.          void SetFlag(long flags,char flagchar);
  1226.          void ClearFlag(long flags,char flagchar);
  1227.          ──────────────────────────────────────────────────────────────────
  1228.  
  1229.          Access flags are stored in a long integer (32 bits). You have 3
  1230.          macros at your disposal to manipulate access flags:
  1231.  
  1232.             GetFlag   : Returns TRUE if flag <flagchar> is set
  1233.             SetFlag   : Turns flag <flagchar> on
  1234.             ClearFlag : Turns flag <flagchar> off
  1235.  
  1236.          <flagchar> must be a value from 1 to 32. 1-26 correspond to A-Z,
  1237.                     while 27-32 are the same as 1-6.
  1238.  
  1239.  
  1240.  
  1241.          ──────────────────────────────────────────────────────────────────
  1242.          int ErrorLevel(void);
  1243.          ──────────────────────────────────────────────────────────────────
  1244.  
  1245.          Returns the errorlevel of the last executed shell command (Through
  1246.          MenuFunction(MENU_SHELL,...))
  1247.  
  1248.  
  1249.  
  1250.          ──────────────────────────────────────────────────────────────────
  1251.          bool GetIniVar(char *fname,char *varname,char *value,int max);
  1252.          bool SetIniVar(char *fname,char *varname,char *value);
  1253.          ──────────────────────────────────────────────────────────────────
  1254.  
  1255.          These functions can be used to read and write to .INI files. These
  1256.          files are similar to the files used by MS Windows. They can be
  1257.          used to store settings for your application (PEX). An example
  1258.          of a .INI file:
  1259.  
  1260.  
  1261.  
  1262.  
  1263.                                       - 22 -
  1264.  
  1265.  
  1266.  
  1267.                DataPath = C:\PB\PEX\MYPEX\DATA
  1268.                ProgPath = C:\PB\PEX\MYPEX
  1269.                MaxUsers = 10
  1270.  
  1271.          This is a standard ASCII file, with each line in the form
  1272.             <varname> = <value>
  1273.  
  1274.          The value of a specific variable can be read by calling the
  1275.          function GetIniVar(). Setting a variable (writing to the .INI file
  1276.          or createing it if it doesn't exist yet) can be done by calling
  1277.          SetIniVar().
  1278.  
  1279.          The parameters for the functions are:
  1280.  
  1281.              <fname>      Name of the .INI file. The extension of the file
  1282.                           will always be changed to .INI by ProBoard.
  1283.              <varname>    Name of the variable (case INsensitive)
  1284.              <value>      For GetIniVar() : a pointer to a buffer where the
  1285.                                             variable's contents will be
  1286.                                             stored.
  1287.                           For SetIniVar() : a pointer to the value of the
  1288.                                             variable.
  1289.              <max>        Maximum number of characters that can be copied
  1290.                           in <value> (including trailing '\0')
  1291.  
  1292.  
  1293.          Return value: FALSE if the file could not be opened or the
  1294.                        variable does not exist.
  1295.  
  1296.  
  1297.  
  1298.          ──────────────────────────────────────────────────────────────────
  1299.          void exit(void);
  1300.          ──────────────────────────────────────────────────────────────────
  1301.  
  1302.          Exits the current pex-program, and unloads it from memory.
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.                                       - 23 -
  1320.  
  1321.  
  1322.  
  1323.          ──────────────────────────────────────────────────────────────────
  1324.          void ExitTSR(void);
  1325.          ──────────────────────────────────────────────────────────────────
  1326.  
  1327.          Exits the current pex-program, and leaves it resident. This has
  1328.          some important implications:
  1329.  
  1330.           - All global and static variables keep their values for
  1331.             subsequent executions.
  1332.           - When the same pex-file is run again through menu function 60,
  1333.             the resident copy will be executed. This will result in faster
  1334.             loading.
  1335.           - Any handlers that were installed will be called.
  1336.  
  1337.  
  1338.  
  1339.          ──────────────────────────────────────────────────────────────────
  1340.          void InstallHandler(int handler,function);
  1341.          ──────────────────────────────────────────────────────────────────
  1342.  
  1343.          This is probably the most advanced and complicated function in the
  1344.          ProBoard SDK. With this function you can set up a "handler" for a
  1345.          specific action. Right now, only two types of handlers are
  1346.          supported: a replacement for the sysopkey-handler and a handler
  1347.          to intercept loss of carrier. This way you can create your own
  1348.          sysopkeys, or change the behaviour of existing sysopkeys. You could
  1349.          create a handler that intercepts the Alt-J key, and write your own
  1350.          flavor. In future versions you will be able to set up handlers for
  1351.          low-level I/O operations. So you could replace all I/O routines by
  1352.          your own functions. This way you can support your own exotic
  1353.          hardware or something like that. Anything goes!
  1354.  
  1355.             handler   : Handler type. At this time, only HANDLER_SYSOPKEY
  1356.                         and HANDLER_HANGUP are supported.
  1357.             function  : A pointer to the handler function you created.
  1358.  
  1359.          You can install as many handlers as you want.  When the PEX is
  1360.          removed from memory (when the PEX exits), all handlers that were
  1361.          installed will be removed by ProBoard.
  1362.  
  1363.          The handler function is a function that returns an integer. The
  1364.          parameters depend on the type of handler you are creating.
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.                                       - 24 -
  1376.  
  1377.  
  1378.  
  1379.          For HANDLER_SYSOPKEY the handler function has to be declared like
  1380.          this:
  1381.  
  1382.          int sysopkeyhandler(KEY k)
  1383.          {
  1384.          ...
  1385.          }
  1386.  
  1387.          A sysopkey handler intercepts any special key that is pressed by the
  1388.          sysop. (like F1,Alt-H,...). You can redefine any key, or add your
  1389.          own.
  1390.  
  1391.  
  1392.  
  1393.          For HANDLER_HANGUP, the handler functions has to be declared like
  1394.          this:
  1395.  
  1396.          int hanguphandler(void)
  1397.          {
  1398.          ...
  1399.          }
  1400.  
  1401.          The hangup handler works a little different: it is called whenever
  1402.          ProBoard exits (carrier lost, sysop hung up,...). It can be used to
  1403.          perform some cleanup for your running PEX file (like closing
  1404.          files, writing data, etc..). You can install the handler at the
  1405.          start of your program and remove it before the program is
  1406.          finished.
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.                                       - 25 -
  1432.  
  1433.  
  1434.  
  1435.          If a handler function decides to do anything, it has to return
  1436.          HANDLED. If the handler wants to leave it up to ProBoard, it must
  1437.          return NOT_HANDLED.
  1438.  
  1439.          This asks for an example I suppose:
  1440.  
  1441.          int keyhandler(KEY k)
  1442.          {
  1443.           if(k == KEY_ALTJ)
  1444.             {
  1445.              printf("\7\rHang on %s! I'm shelling to DOS...",UserFirstName);
  1446.              MenuFunction(MENU_SHELL,"*N*Q*X*!");
  1447.              printf("I'm back!!\n");
  1448.  
  1449.              return HANDLED;
  1450.             }
  1451.            else return NOT_HANDLED;
  1452.          }
  1453.  
  1454.          main(int argc,char *argv[])
  1455.          {
  1456.           InstallHandler(HANDLER_SYSOPKEY,keyhandler);
  1457.  
  1458.           ExitTSR();    /* IMPORTANT */
  1459.          }
  1460.  
  1461.          So what does it do?  It intercepts the sysopkey-function, and
  1462.          checks if the key pressed is Alt-J. If it is, it shells to DOS
  1463.          with swapping ON, and it writes its own messages to the screen.
  1464.          When the sysop returns, the handler returns HANDLED to let
  1465.          ProBoard know that it does not have to process the key. You could
  1466.          use this example in an INIT.PEX file.
  1467.          Is this powerful or what?
  1468.  
  1469.  
  1470.  
  1471.          ──────────────────────────────────────────────────────────────────
  1472.          void RemoveHandler(int handler,function);
  1473.          ──────────────────────────────────────────────────────────────────
  1474.  
  1475.          Removes handler number <handler> which has been installed by
  1476.          InstallHandler().  <function> is the pointer to the handler that
  1477.          should be removed.
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.                                       - 26 -
  1488.  
  1489.  
  1490.  
  1491.          ──────────────────────────────────────────────────────────────────
  1492.          long MsgNum(int area, long id)
  1493.          ──────────────────────────────────────────────────────────────────
  1494.  
  1495.          Returns the message number for message 'id', in area 'area'.  For
  1496.          Hudson and *.MSG, this is identical to the message id (but DO NOT
  1497.          rely on that).  Returns a value < 1 if there is no message number
  1498.          for 'id'.
  1499.  
  1500.  
  1501.  
  1502.          ──────────────────────────────────────────────────────────────────
  1503.          long MsgId(int area, long n)
  1504.          ──────────────────────────────────────────────────────────────────
  1505.  
  1506.          Returns the message id for message number 'n', in area 'area'. For
  1507.          Hudson and *.MSG, this is identical to the message number (but DO
  1508.          NOT rely on that).  Returns a value < 1 if there is no message
  1509.          number 'n'.
  1510.  
  1511.  
  1512.  
  1513.          ──────────────────────────────────────────────────────────────────
  1514.          long HighMsg(int area)
  1515.          ──────────────────────────────────────────────────────────────────
  1516.  
  1517.          Returns the message id of the last message in the given area.
  1518.          Note: if the lastread pointer is higher than what this function
  1519.          returns, DO NOT use FirstMessage()!  The FirstMessage() function
  1520.          does not support reading past the end of the area. (if you know
  1521.          what I mean :-)
  1522.  
  1523.  
  1524.  
  1525.          ──────────────────────────────────────────────────────────────────
  1526.          long NumMsgs(int area)
  1527.          ──────────────────────────────────────────────────────────────────
  1528.  
  1529.          Returns the total number of active messages in the given area.
  1530.  
  1531.  
  1532.  
  1533.          ──────────────────────────────────────────────────────────────────
  1534.          void LocalDisplay(bool showlocal)
  1535.          ──────────────────────────────────────────────────────────────────
  1536.  
  1537.          Enables/Disables local echo of text.  A parameter of TRUE means
  1538.          "enable local display".  FALSE means "disable local display". See
  1539.          _GRAPH.CPP for an example.
  1540.  
  1541.  
  1542.  
  1543.                                       - 27 -
  1544.  
  1545.  
  1546.  
  1547.          ──────────────────────────────────────────────────────────────────
  1548.          void RemoteDisplay(bool showremote)
  1549.          ──────────────────────────────────────────────────────────────────
  1550.  
  1551.          Enables/Disables remote echo of text.  A parameter of TRUE means
  1552.          "enable remote display".  FALSE means "disable remote display".
  1553.          See _GRAPH.CPP for an example.
  1554.  
  1555.  
  1556.  
  1557.          ──────────────────────────────────────────────────────────────────
  1558.          bool RIP()
  1559.          ──────────────────────────────────────────────────────────────────
  1560.  
  1561.          Returns TRUE if RIP was detected and enabled.  FALSE if not...
  1562.  
  1563.  
  1564.  
  1565.          ──────────────────────────────────────────────────────────────────
  1566.          void ShowRIPscrip( char *name )
  1567.          ──────────────────────────────────────────────────────────────────
  1568.  
  1569.          This will send a RIP file located in the RIP directory.  No file
  1570.          extension should be given.  (.RIP is assumed)  The file will not
  1571.          be shown on the local screen.
  1572.  
  1573.  
  1574.  
  1575.          ──────────────────────────────────────────────────────────────────
  1576.          void ResetInactivity( void )
  1577.          ──────────────────────────────────────────────────────────────────
  1578.  
  1579.          Resets the internal inactivity timeout counter.  This function can
  1580.          be used when returning from a shell or after a time-consuming
  1581.          function has been called.  It will prevent the user from being
  1582.          logged off because of inactivity.
  1583.  
  1584.  
  1585.  
  1586.          ──────────────────────────────────────────────────────────────────
  1587.          bool AddTaggedFile( TAGGED_FILE *tag )
  1588.          ──────────────────────────────────────────────────────────────────
  1589.  
  1590.          Adds a file to the internal list of tagged files.  Returns TRUE if
  1591.          the was successfully added, or FALSE if the file was already
  1592.          tagged.
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.                                       - 28 -
  1600.  
  1601.  
  1602.  
  1603.          ──────────────────────────────────────────────────────────────────
  1604.          bool RemoveTaggedFile( TAGGED_FILE *tag )
  1605.          ──────────────────────────────────────────────────────────────────
  1606.  
  1607.          Removes a file from the internal list of tagged files.  Returns
  1608.          TRUE if the tagged file was found and deleted from the list, or
  1609.          FALSE if the tagged file was not in the list.
  1610.  
  1611.  
  1612.  
  1613.          ──────────────────────────────────────────────────────────────────
  1614.          void ClearTaggedFiles( void )
  1615.          ──────────────────────────────────────────────────────────────────
  1616.  
  1617.          Clears the internal list of tagged files (all tags are removed).
  1618.  
  1619.  
  1620.  
  1621.          ──────────────────────────────────────────────────────────────────
  1622.          bool IsTagged( TAGGED_FILE *tag )
  1623.          ──────────────────────────────────────────────────────────────────
  1624.  
  1625.          Returns TRUE if the given file is in the internal list of tagged
  1626.          files, FALSE if not.
  1627.  
  1628.  
  1629.  
  1630.          ──────────────────────────────────────────────────────────────────
  1631.          int GetTaggedFiles( TAGGED_FILE *tagarray , int maxitems )
  1632.          ──────────────────────────────────────────────────────────────────
  1633.  
  1634.          Fills the given array <tagarray> with all the files in the
  1635.          internal list of tagged files (up to a maximum of <maxitems>).
  1636.          This function returns the number of tagged files copied to the
  1637.          array <tagarray> (<= maxitems).
  1638.  
  1639.  
  1640.  
  1641.          ──────────────────────────────────────────────────────────────────
  1642.          bool PutTaggedFiles( TAGGED_FILE *tagarray , int nitems )
  1643.          ──────────────────────────────────────────────────────────────────
  1644.  
  1645.          Fills the internal list of tagged files with the files in the
  1646.          given array <tagarray>. <nitems> is the number of items in the
  1647.          array.  Returns TRUE on success, FALSE on error.
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.                                       - 29 -
  1656.  
  1657.  
  1658.  
  1659.         ┌──────────────────────────────────────────────────────────────────┐
  1660.         │ Global ProBoard Variables                                        │
  1661.         └──────────────────────────────────────────────────────────────────┘
  1662.  
  1663.          You have access to some important ProBoard system variables
  1664.          through global variables defined in PB_SDK.H.
  1665.  
  1666.  
  1667.  
  1668.          ──────────────────────────────────────────────────────────────────
  1669.          word PBVersion;
  1670.          ──────────────────────────────────────────────────────────────────
  1671.  
  1672.          The version number of ProBoard. The high byte is the major version
  1673.          number (eg. 1). The low byte is the minor version number in
  1674.          hex (eg. 0x30). So if you're using ProBoard v1.30, PBVersion will
  1675.          be set to 0x0130 .
  1676.  
  1677.  
  1678.  
  1679.          ──────────────────────────────────────────────────────────────────
  1680.          word Beta;
  1681.          ──────────────────────────────────────────────────────────────────
  1682.  
  1683.          The beta version number of ProBoard. If this number is 0xFFFF,
  1684.          it means that the release version is running. Beta numbers
  1685.          start from 1.
  1686.          For example, when running ProBoard 1.40 Beta/19, PBVersion will be
  1687.          set to 0x0140, and Beta will be set to 19.
  1688.  
  1689.  
  1690.  
  1691.          ──────────────────────────────────────────────────────────────────
  1692.          long BaudRate
  1693.          ──────────────────────────────────────────────────────────────────
  1694.  
  1695.          The current bps rate of the caller. 0 means local.
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.                                       - 30 -
  1712.  
  1713.  
  1714.  
  1715.          ──────────────────────────────────────────────────────────────────
  1716.          USER_REC * CurUser;
  1717.          ──────────────────────────────────────────────────────────────────
  1718.  
  1719.          Pointer to the current user record. You can change any of the
  1720.          field values in the record, but this will not result in any
  1721.          immediate action by ProBoard. For example, if you change the
  1722.          user's level, ProBoard will not know that you changed it, so you
  1723.          will have to tell it by calling AdjustTime();
  1724.  
  1725.          Check the file PB_SDK.H for a description of the USER_REC
  1726.          structure.
  1727.  
  1728.  
  1729.  
  1730.          ──────────────────────────────────────────────────────────────────
  1731.          int UserRecNr;
  1732.          ──────────────────────────────────────────────────────────────────
  1733.  
  1734.          The record number of the current user's record in the file
  1735.          USERS.BBS, starting from 0. This value cannot be changed.
  1736.  
  1737.  
  1738.  
  1739.          ──────────────────────────────────────────────────────────────────
  1740.          int NumLimits;
  1741.          ──────────────────────────────────────────────────────────────────
  1742.  
  1743.          The number of user levels defined in ProCFG. You can access the
  1744.          limit-values through the global array 'Limits'.  This value
  1745.          cannot be changed.
  1746.  
  1747.  
  1748.  
  1749.          ──────────────────────────────────────────────────────────────────
  1750.          LIMIT * Limits;
  1751.          ──────────────────────────────────────────────────────────────────
  1752.  
  1753.          Is an array of all user levels defined, with download and time
  1754.          limits. Check the file PB_SDK.H for information on the LIMIT
  1755.          structure.
  1756.          You are not allowed to change any values! (A good compiler should
  1757.          generate an error or warning if you try to do so)
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.                                       - 31 -
  1768.  
  1769.  
  1770.  
  1771.          ──────────────────────────────────────────────────────────────────
  1772.          char * LoginDate;
  1773.          char * LoginTime;
  1774.          ──────────────────────────────────────────────────────────────────
  1775.  
  1776.          This is the login date & time of the current user.
  1777.  
  1778.            LoginDate[0] : Day portion of login date
  1779.            LoginDate[1] : Month portion of login date
  1780.            LoginDate[2] : Year portion of login date (00-99)
  1781.            LoginTime[0] : Hour portion of login time
  1782.            LoginTime[1] : Minute portion of login time
  1783.            LoginTime[2] : Second portion of login time
  1784.  
  1785.  
  1786.  
  1787.          ──────────────────────────────────────────────────────────────────
  1788.          bool NetEntered;
  1789.          bool EchoEntered;
  1790.          ──────────────────────────────────────────────────────────────────
  1791.   {}
  1792.          These READ-ONLY variables tell you if netmail and/or echomail has
  1793.          been entered during this session.
  1794.  
  1795.  
  1796.  
  1797.          ──────────────────────────────────────────────────────────────────
  1798.          int NumUsers;
  1799.          ──────────────────────────────────────────────────────────────────
  1800.  
  1801.          This READ-ONLY variable is the number of users currently available
  1802.          in the file USERS.BBS.
  1803.  
  1804.  
  1805.  
  1806.          ──────────────────────────────────────────────────────────────────
  1807.          int NodeNumber;
  1808.          ──────────────────────────────────────────────────────────────────
  1809.  
  1810.          This READ-ONLY variable is the current node number.
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.                                       - 32 -
  1824.  
  1825.  
  1826.  
  1827.          ──────────────────────────────────────────────────────────────────
  1828.          char * CurMenu;
  1829.          char * UserFirstname;
  1830.          char * PrevUser;
  1831.          char * StartupPath;
  1832.          char * SysPath;
  1833.          char * PageReason;
  1834.          ──────────────────────────────────────────────────────────────────
  1835.  
  1836.          CurMenu       : Current menu name
  1837.          UserFirstName : First name of current user
  1838.          PrevUser      : Name of previous user
  1839.          StartupPath   : Name of the directory where ProBoard was started
  1840.                          from (with trailing '\')
  1841.          SysPath       : Name of the ProBoard system directory (with
  1842.                          trailing '\')
  1843.          PageReason    : Reason for paging the sysop (as entered by the
  1844.                          user)
  1845.  
  1846.          These are READ-ONLY strings! (except PageReason)
  1847.  
  1848.  
  1849.  
  1850.          ──────────────────────────────────────────────────────────────────
  1851.          word * PageCount;
  1852.          ──────────────────────────────────────────────────────────────────
  1853.  
  1854.          POINTER to the number of sysop pages done by the user.  This value
  1855.          can be changed by changing the unsigned integer pointed to by
  1856.          'PageCount'.
  1857.  
  1858.  
  1859.  
  1860.          ──────────────────────────────────────────────────────────────────
  1861.          CONFIG * Config;
  1862.          ──────────────────────────────────────────────────────────────────
  1863.  
  1864.          A pointer to the current ProBoard configuration structure. See the
  1865.          file PB_SDK.H for a description of the CONFIG structure.
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.                                       - 33 -
  1880.  
  1881.  
  1882.  
  1883.          ┌────────────────────────────────────────────────────────────────┐
  1884.          │ Special-purpose PEX-files                                      │
  1885.          └────────────────────────────────────────────────────────────────┘
  1886.  
  1887.          Several pex-files will be loaded automatically (if present). They
  1888.          perform certain actions like edit a message, set up handlers, etc.
  1889.  
  1890.                INIT.PEX      : Will be loaded and executed before any I/O
  1891.                                has been done.  Use this to set up any
  1892.                                handlers (sysopkey handlers, ...)
  1893.  
  1894.                INIT_1.PEX -
  1895.                INIT_9.PEX    : Is the same as INIT.PEX, but will be loaded
  1896.                                in the order of the numbers. So you can have
  1897.                                up to 10 initialization pex-files.
  1898.  
  1899.                _LOGIN.PEX    : Is run instead of the normal login
  1900.                                procedure.  See the section explaining this
  1901.                                PEX for more information.
  1902.  
  1903.                LOGIN.PEX     : No longer supported!
  1904.  
  1905.                BIRTHDAY.PEX  : Is run after showing NEWS.ANS/ASC if today
  1906.                                is the user's birthday.
  1907.  
  1908.                NEWUSER.PEX   : Is run before the file NEWUSER.A?? is shown.
  1909.  
  1910.                NEWUSER1.PEX  : Is run before the file NEWUSER1.A?? is
  1911.                                shown.
  1912.  
  1913.                NEWUSER2.PEX  : Is run before the file NEWUSER2.ANS/ASC is
  1914.                                shown.
  1915.  
  1916.                WELCOME.PEX   : Is run before the file WELCOME.ANS/ASC is
  1917.                                shown
  1918.  
  1919.                WELCOMEx.PEX  : Is run before the file WELCOMEx.ANS/ASC is
  1920.                                shown (x = 1 to 9)
  1921.  
  1922.                SECxx.PEX     : Executed when a user with security level xx
  1923.                                logs in. Is run before SECxx.ANS/ASC is
  1924.                                shown.
  1925.  
  1926.                EXPIRED.PEX   : Is run before EXPIRED.ANS/ASC is shown, and
  1927.                                after a user's level is lowered because the
  1928.                                subscription date was reached. ProBoard will
  1929.                                send one parameter to this PEX: the original
  1930.                                level, before it was changed by ProBoard.
  1931.  
  1932.                GOODBYE.PEX   : Is run before GOODBYE.ANS is displayed.
  1933.  
  1934.  
  1935.                                       - 34 -
  1936.  
  1937.  
  1938.  
  1939.                GOODBYE2.PEX  : Is run after GOODBYE.ANS is displayed.
  1940.  
  1941.                MSGED.PEX     : Is a replacement of the built-in message
  1942.                                editor. It will be executed with no
  1943.                                parameters. The message that you create has
  1944.                                to be written to a file called MSGTMP.
  1945.                                ProBoard will then read this file and create
  1946.                                a message from it. To let ProBoard know that
  1947.                                the user has aborted a message, delete
  1948.                                MSGTMP.
  1949.  
  1950.                FSED.PEX      : Is similar to MSGED.PEX, but will be
  1951.                                executed if the user has selected the
  1952.                                fullsrceen editor. It works the same way as
  1953.                                MSGED.PEX, but ProBoard will create a MSGTMP
  1954.                                file with the original message if a user is
  1955.                                replying to a message.
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.                                       - 35 -
  1992.  
  1993.  
  1994.  
  1995.  
  1996.          ┌────────────────────────────────────────────────────────────────┐
  1997.          │ Using the _LOGIN PEX                                           │
  1998.          └────────────────────────────────────────────────────────────────┘
  1999.  
  2000.           By writing a _LOGIN.PEX, ProBoard allows you to replace the
  2001.           normal login procedure (not including the new user procedure)
  2002.           with your own.  It is the PEX's responsibility to check for
  2003.           validity of the name entered and to do password checking!
  2004.  
  2005.           Once you determined the record number of the user, you have to
  2006.           call the function SetUser() with the record number as parameter,
  2007.           and exit the PEX immediately.
  2008.  
  2009.           If the user is not in the user database yet, you should exit
  2010.           without calling SetUser(), and set the name that was entered by
  2011.           the user in a memory region supplied by ProBoard to your PEX as
  2012.           the only parameter.  This parameter is a 'dword' in decimal form,
  2013.           so you have to convert it to a pointer using the following
  2014.           procedure:
  2015.  
  2016.           /*----------------------------*/
  2017.           char *pName;
  2018.           dword dwName = 0;
  2019.           char *s;
  2020.  
  2021.           for(s = argv[1] ; *s ; s++)
  2022.              dwName = l_mul(dwName,10L) + (dword)(*s - '0');
  2023.  
  2024.           pName = (char *)dwName;
  2025.           /*----------------------------*/
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.                                       - 36 -
  2049.